<template>
	<!-- 个人简历页面 -->
	<view class="u-rela">
		<!-- 头像 姓名 年龄等 -->
		<div class="u-flex">
			<u-image src="https://wxcode.sowreap.cn/nongmuWeChatImage/static/images/recruit/avatar.png" width="120rpx"
				height="120rpx" shape="circle"></u-image>
			<div class="u-flex-1 u-m-l-20">
				<view>
					<text class="u-font-48 blod">{{ dataList.name }}</text>
					<text class="u-m-l-16 u-font-24 u-tips-color">{{ dataList.category.title }}</text>
				</view>
				<div class="u-flex u-font-26 u-m-t-20">
					{{ handlerGender(dataList.gender) }} <text class="line">|</text>
					{{ calculateAge(dataList.birthday) }}岁 <text class="line">|</text>
					{{ dataList.education }} <text class="line">|</text>
					{{ dataList.address }}
				</div>
			</div>
			<navigator :url="`/pages/recruit/job/fbjl?category_id=${dataList.category_id}`">
				<image class="icon-edit u-m-b-40"
					src="https://wxcode.sowreap.cn/nongmuWeChatImage/static/images/recruit/icon-edit.png"
					mode="widthFix"></image>

			</navigator>

		</div>
		<!-- 技能 -->
		<view class="u-m-t-50 skill-wrap">
			<div class="u-flex u-col-top">
				<!-- <text>1、</text> -->
				<text class="u-flex-1">{{ dataList.content }}</text>
			</div>
			<!-- <div class="u-flex u-col-top">
				<text>2、</text>
				<text class="u-flex-1">热爱学习，平时会主动学习，提高自己的职业相关技能。</text>
			</div>
			<div class="u-flex u-col-top">
				<text>3、</text>
				<text class="u-flex-1">善于与人沟通，良好的团队合作精神和高度的责任感，能够承受压力，有创新精神，保证工作质量。</text>
			</div>
			<div class="u-flex u-col-top">
				<text>4、</text>
				<text class="u-flex-1">对工作态度认真务实。</text>
			</div> -->

		</view>
		<!-- 求职期望 -->
		<div class="title u-flex u-m-t-80">
			<text class="t-line"></text>
			<text class="blod">求职期望</text>
		</div>
		<view class="u-font-40 blod u-m-t-30 u-m-l-20">
			{{ dataList.category.title }}
		</view>
		<view class="salary u-m-t-30 u-m-l-20">{{ dataList.salary }}</view>
		<view class="u-flex">
			<view class="label-item u-m-t-30 u-m-l-20">
				{{ dataList.industry }}
			</view>
		</view>
		<!-- 我申请的职位 -->
		<div class="title u-flex u-m-t-80">
			<text class="t-line"></text>
			<text class="blod">我申请的职位</text>
		</div>
		<navigator url="/pages/recruit/job/zwdetail" class="job-item" v-for="(item,index) in jobList" :key="index">
			<view class="title">{{item.title}}</view>
			<div class="u-flex label-wrap">
				<text v-for="(item2,index2) in item.tag" :key="index2">{{item2}}</text>
			</div>
			<div class="u-flex u-m-t-28">
				<image class="icon-7" src="https://wxcode.sowreap.cn/nongmuWeChatImage/static/images/recruit/icon-7.png"
					mode="widthFix"></image>
				<text class="u-font-24 u-content-color">广州微碳科技有限公司</text>
			</div>
			<view class="salary">{{item.salary}}</view>
		</navigator>

		<u-popup v-model="show" mode="center" border-radius="30">
			<view class="popContent">
				<view class="pop_title">
					您还没有简历哦!
				</view>
				<view class="pop_btn">
					<span @click="tofbjl">去创建</span>
					<span @click="toRecruit_index">取消</span>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				dataList: {},
				show: false,
				jobList: [
					
				],
			}
		},
		onLoad() {
			// 简历详情
			this.get_recruit_resumeDetails();
			
			// 我投递的职位
			this.get_recruit_myChooseJob()
		},
		onPullDownRefresh() {
			// 简历详情
			this.get_recruit_resumeDetails();
			
			// 我投递的职位
			this.get_recruit_myChooseJob()
		},
		methods: {
			// 
			tofbjl() {
				uni.navigateTo({
					url: `/pages/recruit/job/fbjl?id=${this.dataList.id}`
				})
			},

			// 点击取消回到首页
			toRecruit_index() {
				uni.navigateTo({
					url: '/pages/recruit/index'
				})
			},

			// 简历详情
			get_recruit_resumeDetails() {
				uni.showLoading({
					title: '加载中...'
				});
				this.$http({
					url: this.api.recruit_resumeDetails,
					method: 'GET',
				}).then(res => {
					if (res.code == 1) {
						uni.hideLoading();
						uni.stopPullDownRefresh();
						if (res.data.id == 0) {
							this.show = true
							return
						}
						this.dataList = res.data
					}
				})
			},

			// 判断性别函数
			handlerGender(num) {
				if (num == 0) {
					return '未知'
				} else if (num == 1) {
					return '男'
				} else {
					return '女'
				}
			},

			// 根据出生日期计算年龄函数
			calculateAge(birthDate) {
				const birth = new Date(birthDate);
				const current = new Date();
				let age = current.getFullYear() - birth.getFullYear();
				const monthDifference = current.getMonth() - birth.getMonth();
				if (monthDifference < 0 || (monthDifference === 0 && current.getDate() < birth.getDate())) {
					age--;
				}
				return age;
			},

			// 申请岗位列表
			get_recruit_applyList() {
				uni.showLoading({
					title: '加载中...'
				});
				this.$http({
					url: this.api.recruit_applyList,
					method: 'GET',
					data: {

					}
				}).then(res => {
					if (res.code == 1) {
						uni.hideLoading();
						uni.stopPullDownRefresh();
					}
				})
			},
			
			// 我投递的职位
			get_recruit_myChooseJob(){
				uni.showLoading({
					title: '加载中...'
				});
				this.$http({
					url:this.api.recruit_myChooseJob,
					method:'GET'
				}).then(res=>{
					if(res.code == 1){
						uni.hideLoading();
						uni.stopPullDownRefresh();
						this.jobList = res.data.list
					}
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.line {
		color: #ccc;
		margin: 0 16rpx;
	}

	.icon-edit {
		width: 28rpx;
		height: 28rpx;
	}

	.skill-wrap {
		font-size: 28rpx;
		line-height: 1.8;
	}

	.title {
		font-size: 32rpx;
		color: #272829;
		position: relative;
	}

	.t-line {
		width: 5rpx;
		height: 24rpx;
		background: #07C160;
		border-radius: 3rpx;
		margin-right: 20rpx;
	}

	.salary {
		color: #F7661E;
		font-size: 44rpx;
		font-weight: 700;
	}

	.label-item {
		padding: 10rpx;
		margin-right: 10rpx;
		background: #F3F3F3;
		border-radius: 5rpx;
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #999999;
	}

	.job-item {
		width: 710rpx;
		margin: 20rpx auto;
		background: #FFFFFF;
		border-radius: 10rpx;
		box-shadow: 0px 0px 30px 0px rgba(8, 14, 95, 0.1);
		padding: 30rpx;
		position: relative;
		box-sizing: border-box;

		.title {
			font-size: 34rpx;
			margin-bottom: 20rpx;
			font-weight: 700;
		}

		.icon-7 {
			width: 28rpx;
			height: 28rpx;
			margin-right: 10rpx;
		}

		.salary {
			position: absolute;
			top: 32rpx;
			right: 30rpx;
			color: #F7661E;
			font-size: 38rpx;
		}

		.label-wrap {
			text {
				border: 1px solid #DDDDDD;
				border-radius: 5rpx;
				padding: 10rpx;
				font-size: 20rpx;
				color: #999999;
				margin-right: 10rpx;
			}
		}
	}

	.popContent {
		width: 400rpx;
		height: 200rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;

		.pop_title {
			font-size: 34rpx;
			font-family: PingFang-SC-Bold;
			font-weight: bold;
			color: #333333;
		}

		.pop_btn {
			width: 100%;
			box-sizing: border-box;
			padding: 0 30rpx;
			display: flex;
			justify-content: space-between;
			margin-top: 30rpx;

			>span:nth-child(1) {
				width: 160rpx;
				height: 60rpx;
				background: #07C160;
				border-radius: 15rpx;
				font-size: 30rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #FFFFFF;
				text-align: center;
				line-height: 60rpx;
			}

			>span:nth-child(2) {
				width: 160rpx;
				height: 60rpx;
				background: #F3F3F3;
				border-radius: 15rpx;
				font-size: 30rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #999999;
				text-align: center;
				line-height: 60rpx;
			}
		}
	}
</style>
<style>
	page {
		padding: 30rpx;
		background-color: #fff;

	}
</style>